<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        // 1.
        // var nums=["aa","bb","cc","dd","bb","ee","bb"];
        // 查找数组中字符串为bb的个数
        
        var nums=["aa","bb","cc","dd","bb","ee","bb"];
        var count=0;
        for(var i=0;i<nums.length;i++){
            if(nums[i]=="bb"){
                count++;
            }
        }
        console.log("数组中字符串为bb的个数:"+count);


        // 2.
        // var arrs=["alice","lili","cici","baby"];
        // 将其变成字符串:baby*cici*lili*alice

        var arrs=["alice","lili","cici","baby"];
        var str="";
        for(var i=arrs.length-1;i>=1;i--){
            str=str+arrs[i]+"*";//str=""+"baby"+"*"+"cici"+"*"+"lili"+"*"
        }
        str=str+arrs[0];
        console.log(str);

        // 3.
        // var nums=[12,34,89,100,3,99];
        // 将其中3的倍数挑选出来，存放到新的数组中，并在控制台输出这个新数组

        var nums=[12,34,89,100,3,99];
        var newArr=[];
        for(var i=0;i<nums.length;i++){
            if(nums[i]%3==0){
                newArr.push(nums[i]);
            }
        }
        console.log(newArr);


        
    </script>
</head>
<body>
    
</body>
</html>